Skip to content
This repository has been archived by the owner on Nov 23, 2022. It is now read-only.

WIP: Feature: deploy history #38

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

WIP: Feature: deploy history #38

wants to merge 1 commit into from

Conversation

anbraten
Copy link
Contributor

Add deploy history exoframejs/exoframe#67 to list last x deploys.

Roadmap

Features

  • list history

Bonus

  • rollback
  • rebuild
  • restart
  • scale: x instances of current deploy
  • keep last x deploys running (could be nice for pipelines to be able to host prev versions)

Workflow redesign:

Deploying another instance each time you run # exoframe deploy feels somehow strange to me! I would like to suggestion the following workflow:

  • exoframe.json is missing (first deploy) => cli asks for config generation, creates exoframe.json and deploys to the server
  • exoframe.json exists in project => cli deploys to server, server detects running instance and starts update

A static url of a deployment would be nice as well (already requested in exoframejs/exoframe#275).
Currently I can think of these options:

  • {username}-{project}.example.org:
    • PRO: url can be easily guessed before deploying
    • CON: sharing the project (project name in exoframe.json) with git, etc. wouldn't allow the same user to deploy a second instance (you would have to change the project name to prevent an update)
      This however could be fixed in the future by adding the ability to scale deployments.
  • {project}-{uuid}.example.org:
    • CON: cli would need to save uuid somehow locally (exp. {project-dir}/exoframe/config.json) to be able to update deployment
    • PRO: easily able to deploy multiple instance of same project
  • {uuid}.example.org: (least favorite)
    • CON: url tells nothing about the project

@yamalight Any suggestions?

PS: I already changed code to only create one database file with all needed collections instead of multiple ones, except for the request token memory database. That shouldn't be a problem, should it?

}

// get or create deploys collection
deploysCollection = db.getCollection('deploys');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially though of using file-based catalogue of deploys.
I.e. you'd have a top folder projectName and nested 3-5 folders with dates as name corresponding to deployments.
This way you don't need to maintain a DB (and its relation to files) and can easily figure out when a deploy happened and what files need to be used to run it.
Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will first try whether it works with files. Adding data to the database later doesn't sound too complicated to me.

@yamalight
Copy link
Contributor

I've added a small comment to db code. IMO file-based approach would be easier to maintain.

exoframe.json is missing (first deploy) => cli asks for config generation, creates exoframe.json and deploys to the server

One of the points is to allow one command deployments for simple projects. This kinda breaks the flow. If you want to deploy with defaults - you just run exoframe. If you want custom config - you run exoframe config and set whatever you need. Not convinced this change is warranted 🤔

A static url of a deployment would be nice as well (already requested in exoframejs/exoframe#275).

Definitely want to have that, but that feels out of scope for this PR

Copy link
Contributor Author

@anbraten anbraten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I got your point of the single command to deploy idea.

Main reason I suggested this change was to somehow remove the /update endpoint and handle all requests by the /deploy endpoint.

This way the server would decide whether to deploy a new instance if username/projectName wasn't found or to update an already deployed instance.
If no exoframe.json config is found inside the current folder projectName could be the current folder name.

A static url of a deployment would be nice as well (already requested in exoframejs/exoframe#275).
Definitely want to have that, but that feels out of scope for this

If we choose to store deployments without a uuid to a folder at "deploys/username/projectName", IMO the URL shouldn't use a uuid as well.

@yamalight
Copy link
Contributor

Main reason I suggested this change was to somehow remove the /update endpoint and handle all requests by the /deploy endpoint.

This separation exists for a reason - there are cases when you want to have same deployment executed multiple times. If you can suggest a way to merge those two, but still retain the functionality to do a second deploy under same project / URL - would be totally up for that 🤔

If we choose to store deployments without a uuid to a folder at "deploys/username/projectName", IMO the URL shouldn't use a uuid as well.

As I said - I'm totally up for that. I don't like UUID presence in URLs as well 😅 I just don't think it quite fits within deploy history feature

@anbraten
Copy link
Contributor Author

anbraten commented Mar 26, 2020

This separation exists for a reason - there are cases when you want to have same deployment executed multiple times. If you can suggest a way to merge those two, but still retain the functionality to do a second deploy under same project / URL - would be totally up for that thinking

Could you give an example how and what you want to achieve by executing same deployment multiple times. Sounds to me like scaling. Maybe adding an option to config or a scaling-command would be a solution? Should a second deployment use the same project files and url?

@yamalight
Copy link
Contributor

Sure. There are two cases here:

  1. Scaling as you've said. Since there's no other way to scale right now 😅
  2. Deploying new immutable versions of project (e.g. we have exoframe setup to deploy new version for each PR we open, then tear it down once it's closed). Uses same project, but generates new URL on every deployment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants